﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HighDivePrinter.Model;

using System.Xml;
using System.Xml.Serialization;
using System.ComponentModel;

namespace HighDivePrinter.Model
{
     [Serializable()]
    public class DiveScore : IComparable<DiveScore>
    {
        #region Properties
        private double _Score;
        

        public double Score 
        {
            get
            {
                return _Score;
            }
            set
            {
                _Score = value;
                if (this.PropertyChanged != null)
                    this.PropertyChanged(this, new PropertyChangedEventArgs("Score"));
            }
        }

        public Judge Judge { get; set; }

        #endregion

         #region Constructors
        public DiveScore()
        {
           
            this.Score = Score;
        }
         #endregion


        #region IComparable Members

        /// <summary>
        /// Method that defines comparison of two Divers.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public int CompareTo(DiveScore obj)
        {
            int c = this.Judge.JudgeNumber.CompareTo(obj.Judge.JudgeNumber);
            if (c == 0)
                return this.Score.CompareTo(obj.Score);
            else
                return c;
        }

        #endregion

        #region INotifyPropertyChanged Members
        /// <summary>
        /// Event declaration.
        /// </summary>
        public event PropertyChangedEventHandler PropertyChanged;

        #endregion
    }
}
